package com.softao.ming.gde.internal.core.model;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.softao.ming.gde.core.model.IBundleBuildFile;

/**
 * 
 */
public class BundleBuildFileImpl implements IBundleBuildFile {
	private Properties mProperties;
	
	/**
	 * @param inputStream 
	 * @throws IOException 
	 */
	public BundleBuildFileImpl(InputStream inputStream) throws IOException {
		mProperties = new Properties();
		mProperties.load(inputStream);
	}
	
	/**
	 * @param key
	 * @return <code>true</code> the key exists; otherwise, <code>false</code>.
	 */
	public final boolean contains(String key) {
		return mProperties.containsKey(key);
	}
	
	/**
	 * @return source folders
	 */
	public String[] getSourceFolders() {
		String source = mProperties.getProperty("source..");
		return source == null ? new String[0] : source.split(",");
	}

	@Override
	public String get(String key) {
		return mProperties.getProperty(key);
	}

}
